package ro.imc.ums.domnica;

import java.beans.XMLEncoder;
import java.io.BufferedOutputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.util.List;

public class EncodeXML {
	
	public EncodeXML(){
		
	}
	
	public void encodeXML(List<Person> list, String fileName, String directory){
		try{
			
		
			final XMLEncoder encoder = new XMLEncoder(new BufferedOutputStream(
			          new FileOutputStream("D:\\XML\\"+ directory + "\\"+ fileName + ".xml")));
			      encoder.writeObject(list);
			      encoder.close();
				
		
		} catch (FileNotFoundException ex){
			ex.printStackTrace();
		}
	}
}
